import { BasicColumn, FormSchema } from '@/components/Table';
import { useMessage } from '@/hooks/web/useMessage';
import dayjs from 'dayjs';

export const columns: BasicColumn[] = [
  {
    title: '订单号',
    dataIndex: 'a',
    width: 180,
    align:'left',
    fixed: 'left',
    customRender:({ record })=>{
      return record.status;
    }
  },
  {
    title: '商品数量',
    dataIndex: 'b',
    width: 80,
    customRender:({ record })=>{
      return record.status;
    }
  },
  {
    title: '订单金额',
    dataIndex: 'c',
    width: 80,
    customRender:({ record })=>{
      return '$ ' + record.status;
    }
  },
  {
    title: '优惠金额',
    dataIndex: 'c',
    width: 80,
    customRender:({ record })=>{
      return '$ ' + record.status;
    }
  },
  {
    title: '订单描述',
    dataIndex: 'd',
    align: 'left',
    customRender:({ record })=>{
      return record.roleName;
    }
  },
  {
    title: '支付信息',
    dataIndex: 'payInfo',
    width: 120,
  },
  {
    title: '状态',
    dataIndex: 'status',
    width: 120,
    sorter: true,
  },
  {
    title: '下单人',
    dataIndex: 'user',
    width: 120,
  },
  {
    title: '创建时间',
    dataIndex: 'id',
    width: 180,
    sorter: true,
    fixed: 'right',
    customRender: ({record})=>{
      return record.createTime;
    }
  },
];

export const searchFormSchema: FormSchema[] = [
  {
    field: '[startDate, endDate]',
    label: '下单时间',
    labelWidth: 80,
    component: 'RangePicker',
    colProps: { xs: 24, xl: 12, lg: 8, xxl: 6 },
    componentProps: {
      format: 'YYYY-MM-DD HH:mm:ss',
      placeholder: ['开始日期、时间', '结束日期、时间'],
      showTime: { format: 'HH:mm:ss' },
    },
    defaultValue: [
      dayjs(
        new Date(new Date().getFullYear(), new Date().getMonth(), new Date().getDate() - 7),
      ).format('YYYY-MM-DD'),
      dayjs(new Date()).format('YYYY-MM-DD'),
    ],
  },
  {
    field: 'status',
    label: '订单状态',
    labelWidth: 80,
    component: 'Select',
    componentProps: {
      options: [
        // { label: '待支付', value: '100' },
        // { label: '已支付', value: '101' },
        { label: '发货中', value: '200' },
        { label: '已签收', value: '201' },
        { label: '退货中', value: '300' },
        { label: '已完成', value: '400' },
        { label: '已取消', value: '500' },
        { label: '已关闭', value: '600' },
      ],
    },
    colProps: { xs: 24, xl: 12, lg: 8, xxl: 6 },
  },
  {
    field: 'bucket',
    label: '支付方式',
    labelWidth: 80,
    component: 'Select',
    componentProps: {
      options: [
        { label: '支付宝', value: 'alipay' },
        { label: '微信支付', value: 'wechatpay' },
      ],
    },
    colProps: { xs: 24, xl: 12, lg: 8, xxl: 6 },
  },
  {
    field: 'payNo',
    label: '支付单号',
    labelWidth: 80,
    component: 'Input',
    colProps: { xs: 24, xl: 12, lg: 8, xxl: 6 },
  },
  {
    field: 'orderNo',
    label: '订单编号',
    labelWidth: 80,
    component: 'Input',
    colProps: { xs: 24, xl: 12, lg: 8, xxl: 6 },
  },
  {
    field: `field11`,
    label: ` `,
    labelWidth: 80,
    slot: 'custom',
    colProps: { xs: 24, xl: 12, lg: 8, xxl: 6 },
  },
];
